package com.wiscamp.ninechapters.common.exception;

/**
 * 数据访问异常类
 *
 * @author yifeng
 */
public class DataException extends ApplicationException {
    public void setInnerException(Exception innerException) {
        this.innerException = innerException;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setData(Object data) {
        this.data = data;
    }

    private Exception innerException;

    private String code;

    private Object data;

    public DataException(String message) {
        super(message);
    }

    public DataException(Exception innerException, String code, Object data) {
        super(ExceptionCodeHelper.getInstance().getDataExceptionMessage(code.toLowerCase()));
        this.innerException = innerException;
        this.code = code;
        this.data = data;
    }

    public Exception getInnerException() {
        return this.innerException;
    }

    public String getCode() {
        return this.code;
    }

    public Object getData() {
        return this.data;
    }
}
